package com.moioo.exam;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.struts.action.ActionForm;

/**
 * TFile entity.
 * 
 * @author MyEclipse Persistence Tools
 */

public class TFile extends ActionForm implements java.io.Serializable {
	private static final long serialVersionUID = 5479262311524975736L;
	private String id;
	private String name;
	private Integer classid;
	private String keyword;
	private String note;
	private Date createtime;
	private String createuser;
	private Integer state;
	private String ext;
	private String author;
	private Integer hit;
	// Constructors

	public String getExt() {
		return ext;
	}
	public String getFileClassName(){
		if(classid != null){
			THtmlThread fc = THtmlThread.getDAO().findById(classid);
			if(fc != null)return fc.getName();
		}
		return null;
	}
	public void setExt(String ext) {
		this.ext = ext;
	}

	/** default constructor */
	public TFile() {
		state = 1;
		classid = 0;
	}

	/** minimal constructor */
	public TFile(String name, Integer classid, Integer state) {
		this.name = name;
		this.classid = classid;
		this.state = state;
	}

	/** full constructor */
	public TFile(String name, Integer classid, String keyword, String note,
			Date createtime, String createuser, Integer state) {
		this.name = name;
		this.classid = classid;
		this.keyword = keyword;
		this.note = note;
		this.createtime = createtime;
		this.createuser = createuser;
		this.state = state;
	}

	// Property accessors

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getClassid() {
		return this.classid;
	}

	public void setClassid(Integer classid) {
		this.classid = classid;
	}

	public String getKeyword() {
		return this.keyword;
	}

	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	public String getNote() {
		return this.note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public Date getCreatetime() {
		return this.createtime;
	}
	public String getCreateTimeString(){
		if(createtime == null)return "";
		return new SimpleDateFormat("yy-MM-dd HH:mm").format(this.createtime);
	}
	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	public String getCreateuser() {
		return this.createuser;
	}

	public void setCreateuser(String createuser) {
		this.createuser = createuser;
	}

	public Integer getState() {
		return this.state;
	}

	public void setState(Integer state) {
		this.state = state;
	}
	public static TFileDAO getDAO(){
		return new TFileDAO();
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
	public int getHit() {
		return this.hit;
	}

	public void setHit(int hit) {
		this.hit = hit;
	}
}